﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;

namespace MiniFox.Platform.Jwt.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public class JwtConfiguration
    {
        internal const string ELEMENT_NAME = "minifox:jwt";
        const int CACHE_DURATION = 3600;
        const int ACCESS_TOKEN_EXPIRES = 36000;
        /// <summary>
        /// 
        /// </summary>
        public JwtConfiguration()
        {
            this.CacheDuration = CACHE_DURATION;
            this.AccessTokenExpires = ACCESS_TOKEN_EXPIRES;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("cacheDuration")]
        public int CacheDuration { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("defaultIV")]
        public string DefaultIV { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("signatureAlgorithm")]
        public SignatureAlgorithm SignatureAlgorithm { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("tokenIssuer")]
        public string TokenIssuer { get; set; }
        /// <summary>
        /// 接入方访问令牌过期时长(秒),默认值7200
        /// </summary>
        [ConfigurationKeyName("accessTokenExpires")]
        public int AccessTokenExpires { get; set; }
    }
}
